package com.linkgap.cloud.service;

import cn.hutool.core.util.StrUtil;
import com.linkgap.cloud.entity.Teacher;
import com.linkgap.cloud.repo.TeacherRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TeacherService {


    @Autowired
    private TeacherRepo teacherRepo;


    /**
     * 传入老师名字，查询老师表，返回老师的id
     */
    public Long queryTeacherIdByTeacherName(String name) {
        if (StrUtil.isEmpty(name)) {
            return null;
        }
        Teacher teacher = teacherRepo.findByName(name);
        return teacher.getId();

    }
}